<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .main {
            width: 500px;
            height: 500px;
            background: skyblue;
        }

        .main .box {
            height: 150px;
            width: 150px;
            background: orange;
        }

        body:hover .main {
            transform: rotate(360deg);
            transition: all 1s;
        }

        body:hover .box {
            transform: rotate(-360deg);
            transition: all .5s;
        }
    </style>
</head>

<body>
    <div class="main">
        <div class="box"></div>
    </div>
</body>

</html>